/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gisgraph.components;

import java.util.ArrayList;
/**
 *
 * @author korek
 */
public class StateVertex {
    private String name = "";
    private Group group;
    private int id1, id2, id3;

    public StateVertex(String name)
    {
        this.name = name;
    }
    
    public StateVertex(String name, int id1, int id2, int id3)
    {
        this.name = name;
        this.id1 = id1;
        this.id2 = id2;
        this.id3 = id3;
    }
    
    public int getId1() {
        return id1;
    }

    public void setId1(int id1) {
        this.id1 = id1;
    }

    public int getId2() {
        return id2;
    }

    public void setId2(int id2) {
        this.id2 = id2;
    }

    public int getId3() {
        return id3;
    }

    public void setId3(int id3) {
        this.id3 = id3;
    }
    private ArrayList<String> nodes = new ArrayList();

        
    public boolean addNode(String node)
    {
        if(node.length() < 3)
        {
            this.nodes.add(node);
            return true;
        }else
            return false;
    }
    
    public ArrayList<String> getNodes() {
        return nodes;
    }

    public void setNodes(ArrayList<String> nodes) {
        this.nodes = nodes;
    }
    
    public Group getGroup() {
        return group;
    }

    public void setGroup(Group group) {
        this.group = group;
    }    

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    public int countNodes(int node)
    {
        int match = 0;
        if(id1 == node)
            ++match;
        if(id2 == node)
            ++match;
        if(id3 == node)
            ++match;
        
        return match;
    }
    
    @Override
    public String toString()
    {
        return id1 + ", " + id2 + ", " + id3;
    }
    
}
